home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Chip 1998 September
/
CHIP Eylül 1998.iso
/
Slackwar
/
docs
/
mini
/
Sendmail+UUCP
< prev
next >
Wrap
Text File
|
1997-11-15
|
15KB
|
419 lines
SENDMAIL + UUCP HOWTO
_Author:_ Jamal Hadi Salim (jamal@glcom.com or hadi@cyberus.ca)
History:
Initial edition July/96: works only with non-bind edition of sendmail
Oct 01 /96: works with the redhat supplied binary
Oct 07 /96: added/modified a tip on how to compile non-bind sendmail
Oct 25 /96: added/modified a tip on how to keep sendmail
getHostbyAddr() happy via a dummy /etc/hosts entry
Mar 15 /97: I am amazed at the response/feedback i am receiving so i
decided to refine this further. Fixed some small errors; added diagram
+ references.
Oct 25/97: Htmlise+ add blurb on DNS capable machines
_________________________________________________________________
After finally settling down and properly reading TFM (the Bat Book, to
be precise) i have solved the Caramilk secret! The steps below have
been tested with the binary supplied by RedHat. Perhaps i should send
this tip to the maintainer of the Sendmail FAQ too since there is
absolutely no mention of UUCP interworking with sendmail there.
What this Document tries to show you
How to setup a single machine, reffered to as _me.com _in the example,
with no direct access to the internet to route mail for you via
sendmail and UUCP to a 'smarter host' eg your ISP.
Optionally you can configure this machine to feed other machines i.e
you are their 'smart' host or gateway.
What this Document does not tell you
I have been receiving incredible number of questions regarding topics
which are beyond the focus of this HOWTO. The purpose of this document
is not to describe them so please try not send me any questions on the
following:
a) How to setup UUCP.
Refer to many fine references on this, including:
UUCP HOWTO (Vince Skahan, )
Using and managing UUCP (Ed Ravin et al -- publisher O'reilly) which i
think is the best authority on UUCP
Linux Network Administrator Guide (Olaf Kirch)
b) how to setup DNS.
Refer to the many fine references on this, including:
Caching named mini howto (Nicolai Langfeldt)
The bat book (Sendmail;Costalles, Allman, Rickert;publisher O'reilly)
DNS and BIND (Publisher O'reilly)
TCP/IP Network Administration (Hunt, Craig;Publisher O'reilly)
Linux Network Administrator Guide (Olaf Kirch)
sendmail Theory and Practice (Avolio and Vixie; publisher Digital
press)
c) how to setup databases (other than the mailertable) to work with sendmail.
Refer to the many fine references on this, including:
The bat book (Sendmail;Costalles, Allman, Rickert -- publisher
O'reilly)
TCP/IP administration (Publisher O'reilly)
Sendmail Theory and Practice (Avolio and Vixie; publisher Digital
press)
Docs bundled with sendmail d) how to write or modify rulesets or
mailers.
All the above references in c)
You can also find help on the following _newsgroups_:
comp.mail.sendmail
comp.mail.uucp
comp.os.linux.networking
_IRC channels_
#linux, #unix
_________________________________________________________________
THE SETUP
This is for a system, hypothecally named _me.com_, whose mail is sent
out only via UUCP. _mysmarthost _is the ISPs hostname as set up in the
_uucp sys file _and _me.com _is the hostname we use or are known by in
the MX records on the internet.
_mysmarthost_ hooks to the internet. We really dont care how it does
it, we just know it knows how to get us there.
_me.com_, whose setup we describe in the example, feeds sites
_down.com _and _system1.org _and their subnodes. _me.com _connects to
_down.com_ via TCP/IP and connects to _system1.org _via raw UUCP using
a phone line.
The setup description is shown below:
------------------------
| |
| Internet |
| |
-----------------------
|
| PPP/dedicated line running TCP-IP
|
-------------
| |
|mysmarthost | Authoritative name server for
| | *.me.com, *.down.com, *.system1.org
| |
--------------
|
| UUCP via a phone line receive for
| system1.org, *.system1.org,*.down.com, down.com
| as well as me.com and *.me.com
------------
| * ***** * |
------------ | * me.com * | ------
| * * | |
| | * ***** * | |
| ------------ |
|UUCP via phone line | uucp via TCP/IP
| |
----------- -----------
| | | |
|system1.org| | down.com |-------
| | | | |
---------- ------------ |
| &
nbsp; |
| &
nbsp; |
| &
nbsp; | LAN: smtp to nodes
| UUCP phone line
| &
nbsp; |
----------- -------------
| | | &nbs
p; |
|system1's| | down's |
|subnodes | | LAN |
| | ------------
----------
pre-requisites
_1)_ If you are already running DNS or have a pointer to a DNS server
(in your /etc/resolv.conf) and are on a live connection to the net
then skip this part. You are safe. You dont have to do any 'smart'
thing skip to _2)_
If you are on a machine using uucp for mail then you dont really need
to compile bind/resolv into sendmail;
How to survive name canonicalization on a stand-alone machine with no DNS
_PART I_
If you get a pre-compiled sendmail with BIND in it you can still live
with it (As is the case with Redhat supplied sendmail).
a) Refer to my solution for this based on the m4 file described (my
favorite). Try to use this option unless you really insist on b) or c)
below OR
b)If you talk to me i could supply you with a non-BIND compiled
version (8.8.5). Perhaps RedHat should consider supplying two sendmail
binaries (like slakware) One with BIND and the other with no BIND. OR
c) The quickest solution to get sendmail with no bind is to edit
_src/conf.h_ lines below to read as i have shown:
_# ifndef NAMED_BIND conf.h:# define NAMED_BIND 0 /* use Berkeley
Internet Domain Server */_
_PART II_:
Sendmail would however normally insist on doing name look ups to
resolve the host part using _gethostbyaddr()_ for each email it sends
(even if you tell it not to canonify names).
a) use an _RFC1597_ IP address (10.0.0.0-10.255.255.255,
172.16.0.0-172.31.255.255, 192.168.0.0-192.168.255.255)
Edit _/etc/hosts _and add the following as a sample for the host
myhost
_10.0.0.1 myhost.me.com myhost_ or
b) If you use NIS (and NIS is compiled into sendmail as seems to be
the case in Redhat. ) make sure the _/etc/nsswitch.conf _file
contains:
_hosts: files dns_ and in _/etc/hosts_ and add the following as a
sample for the host myhost [again using RFC1597 IP addressing scheme]
_10.0.0.1 myhost.me.com myhost_
_NOTE: _---- In both a) and b) above it is critical that you list the
long (fully qualified) in the /etc/hosts file used. i.e the line
should read _10.0.0.1 myhost.me.com myhost_ and NOT _10.0.0.1 myhost
_you will also need to define the sendmail _$j _macro to hold
_myhost.me.com_
add the Following line to your _/etc/sendmail.cf _after it is
generated _Djmyhost.me.com_ (or you can use
_MASQUAREADE_AS(myhost.me.com)_ in the _.mc_ below)
_NOTE_!!!!! _myhost_ as a domain name is given as an example; you dont
have to use it as is. Pick your own hostname if you dont have one
already.
_________________________________________________________________
__
_2)_ Ensure that you have makemap and it is capable of supporting hash
and or the more common dbm format or even btree format (The Redhat
version does not support dbm). Makemap is normaly distributed with
sendmail.
SETUP (the mc file)
I) create your .mc file using your favorite editor; i'll call this
file _my.mc_
_a) No DNS -- standalone_
_________________________________________________________________
i_nclude(`../m4/cf.m4')_
_VERSIONID(`me.com's setup with uucp created by xxxx --no dns ')_
_dnl OSTYPE(linux)_
_FEATURE(nodns)dnl_
_FEATURE(nocanonify)dnl_
_FEATURE(always_add_domain)dnl_
_FEATURE(mailertable, hash /etc/mailertable)dnl_
_MAILER(local)dnl_
_MAILER(smtp)dnl_
_MAILER(uucp)_
_define(`SMART_HOST', uucp-dom:mysmarthost)_
_________________________________________________________________
Let's dissect this:
_include(`../m4/cf.m4')_ requests for the m4 macro found in
../m4/cf.m4 to be include to resolve some things
_VERSIONID(`me.com's setup with uucp created by xxxx')dnl_ This is
used to distinguish the different versions of .cf file you might end
up creating.
_OSTYPE(linux)_ This is used to define/redefine linux specific stuff.
It is safe to have it here.
_FEATURE(nodns)dnl _This says we dont have a DNS server (so in effect
we are using uucp only for mail. Sendmail must be compiled not to use
bind) This is now obsolete. I will let it stay here just in case you
use an older version of sendmail.
_FEATURE(nocanonify)dnl _This says Don't pass addresses to _$[ ... $]_
for canonification. Normally if you have BIND compiled in sendmail
would try and expand the alias/IP address to a canonical name using
DNS. You dont wanna do this if all you have are feeds which connect to
you via UUCP i.e you are a stand alone.
_FEATURE(always_add_domain)dnl_ This adds the local domain host name
even on locally delivered mail Not necessary i just like it; _This
might not be a safe feature since spammers, with proper setup
conditions, can abuse you_.
me.com is not connected to the net via tcp/ip so it is safe
_FEATURE(mailertable, hash /etc/mailertable)dnl_ the file
_/etc/mailertable_ is going to be a _hash _database where we will
store routing information of certain sites. If you dont have anyone
who you feed uucp to then you dont need this. More on this later. If
you wanted to use the _dbm _format you would have_
FEATURE(mailertable, dbm /etc/mailertable)dnl _If you wanted to use
the _btree_ format you would have _FEATURE(mailertable, btree
/etc/mailertable)dnl_
_MAILER(local)dnl MAILER(smtp)dnl MAILER(uucp)_ These are the mailers
we use.
_define(`SMART_HOST', uucp-dom:mysmarthost) _Our smart host is our ISP
who is defined in the uucp _sys_ file as _system mysmarthost_. Any
messages that we cant handle (i.e ones for domains or mailers we dont
understand) will be passed on to our smarthost/ISP to figure out. note
we use uucp-dom as the uucp mailer. This particular mailer uses smtp
rewriting rules.
_b) DNS on_
_________________________________________________________________
_include(`../m4/cf.m4')_
_VERSIONID(`me.com's setup with uucp created by xxxx --dns
enabled')dnl_
_OSTYPE(linux)_
_FEATURE(always_add_domain)dnl_
_FEATURE(mailertable, hash /etc/mailertable)dnl_
_MAILER(local)dnl_
_MAILER(smtp)dnl_
_MAILER(uucp)_
_define(`SMART_HOST', uucp-dom:mysmarthost)_
_________________________________________________________________
II) create your sendmail.cf file
a) backup your old _/etc/sendmail.cf_ file
b) overwrite the sendmail.cf with the new one: _m4 my.mc >
/etc/sendmail.cf_
c) verify that the sendmail.cf file was correctly created based on
your specifications.
Some of the gotchas that i came across were: - _missing uucp-dom
mailer _This was because i didnt have the smtp mailer entry. Actually,
i understand it is important to have it defined before the uucp
III) create your /etc/mailertable
if you dont have uucp sites feeding off you skip this step
a) create/edit the file /etc/mailertable
sample /etc/mailertable
_________________________________________________________________
_system1.org uucp-dom:system1_
_.system1.org uucp-dom:system1_
_down.com uucp-dom:down_
_up.down.com error: Host is unknown at me.com_
_.down.com uucp-dom:down_
_.me.com error: Host unknown at me.com_
_________________________________________________________________
This says anything that is addressed to _system1.org_ or to
_*.system1.org _that we receive will be sent using the _uucp-dom_
mailer and be delivered to _system1_ (defined in the the uucp _sys
_file) in other words we are doing the mail routing for _*.system1.org
; _similar for _down.com _and its subnodes except for the additional
filtering; we bounce back any mail for down's subnode _up.down.com
_using sendmail's built-in _error _mailer with the message _"Host is
unknown at me.com"_; This is because we have been asked to do this by
the admin at _down.com._ To bounce unknown subdomains to us we use the
last line in the mailertable (which is what all unknown nodes default
to).
b) create the database with _makemap_
if you use _hash_:
_makemap hash /etc/mailertable < /etc/mailertable_
if you use _dbm:_
_makemap dbm /etc/mailertable </etc/mailertable_
if you use_ btree:_
_makemap btree /etc/mailertable </etc/mailertable___
do this every time you change the file.
__
IV) restart sendmail
V) test sendmail
i) sendmail -bv user@destination
ii) using sendmail -bt and enter various addresses using 3,0
ruleset to see where they end up and the various rulesets and cf walks
taken.
_You are set!_
_________________________________________________________________
TODO
1) Add info on setting up system down.com (so as to show how to
take care of those smtp nodes)
2) Add info on how to setup news to be delivered via UUCP
(preferably INN). This might require changing the title of the doc.